Skip to content

Handle error messages from response body in every network backend like curl#8

Merged
andinux merged 8 commits intomainfrom
fix-error-messages
Aug 4, 2025
Merged

Handle error messages from response body in every network backend like curl#8
andinux merged 8 commits intomainfrom
fix-error-messages

Conversation

@Gioee
Copy link
Member

@Gioee Gioee commented Aug 2, 2025

No description provided.

@Gioee Gioee self-assigned this Aug 2, 2025
@Gioee Gioee added bug Something isn't working enhancement New feature or request labels Aug 2, 2025
@Gioee
Copy link
Member Author

Gioee commented Aug 2, 2025

Here's the difference between the old and the new error messages from integration test example

Old one

gio@Computer-portatile-di-Gioele sqlite-sync % make test NATIVE_NETWORK=1
gcc -Wall -Wextra -Wno-unused-parameter -Isrc -Isqlite -Icurl/include -arch x86_64 -arch arm64 -DCLOUDSYNC_OMIT_CURL -O3 -fPIC -c src/network.m -o build/release/network_m.o
gcc  build/release/cloudsync.o  build/release/dbutils.o  build/release/lz4.o  build/release/network.o  build/release/pk.o  build/release/utils.o  build/release/vtab.o  build/release/wasm.o  build/release/network_m.o  -o dist/cloudsync.dylib -L./curl/macos -lcurl -arch x86_64 -arch arm64 -framework Security -dynamiclib -undefined dynamic_lookup -framework Foundation
strip -x -S dist/cloudsync.dylib
sqlite3 ":memory:" -cmd ".bail on" ".load ./dist/cloudsync.dylib" "SELECT cloudsync_version();"
0.8.12
set -e; for t in dist/main dist/unit; do ./$t; done


Integration Test cloudsync_version(): 0.8.12 
===========================================
Version Test:            OK
Error while executing SELECT cloudsync_network_sync(250,10);: Unknown network URL
Error: Unknown network URL
Init+Sync Test:          FAILED
Is Enabled Test:         OK
DB Version Test:         OK
Error while executing SELECT cloudsync_network_send_changes();: Unknown network URL
Error: Unknown network URL
Enable Disable Test:     FAILED

New one

gio@Computer-portatile-di-Gioele sqlite-sync % make test NATIVE_NETWORK=1
sqlite3 ":memory:" -cmd ".bail on" ".load ./dist/cloudsync.dylib" "SELECT cloudsync_version();"
0.8.12
set -e; for t in dist/main dist/unit; do ./$t; done


Integration Test cloudsync_version(): 0.8.12 
===========================================
Version Test:            OK
Error while executing SELECT cloudsync_network_sync(250,10);: 403 Device limit reached: You’ve already registered the maximum number of devices allowed by your current plan.
Error: 403 Device limit reached: You’ve already registered the maximum number of devices allowed by your current plan.
Init+Sync Test:          FAILED
Is Enabled Test:         OK
DB Version Test:         OK
Error while executing SELECT cloudsync_network_send_changes();: 403 Device limit reached: You’ve already registered the maximum number of devices allowed by your current plan.
Error: 403 Device limit reached: You’ve already registered the maximum number of devices allowed by your current plan.
Enable Disable Test:     FAILED

make: *** [test] Error 2

@Gioee
Copy link
Member Author

Gioee commented Aug 2, 2025

And in react/wasm the difference is that the error wasn't even reported, now the wasm version gets it and it is also shown on screen

@andinux andinux requested review from andinux and removed request for marcobambini August 4, 2025 09:03
@andinux andinux merged commit d22fb98 into main Aug 4, 2025
10 checks passed
@danielebriggi danielebriggi deleted the fix-error-messages branch August 5, 2025 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants